package GUI;
/**
 * Managment screen in order to unblock parent users
  */

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.Vector;

public class ManagmentSelParentUnblock extends JPanel {
	private JLabel lblBlockScreen = null;
	private JLabel lblSelectParent = null;
	private JComboBox selParentcB = null;
	private JButton btnUnBlock = null;
	public UserManagment user = null;
	public ManagmentMainMenu mmn = null;
	public Login myLoginFrame = null;
	private String name=null;
	
	
	public JComboBox getSelParentCb(ManagmentMainMenu mmn)
	{ 
		
		Vector<String> data = new Vector<String>();
		
		int i;
		
		for(i=0;i<mmn.user.data.Parents.size();i++)
		{
			data.add(mmn.user.data.Parents.get(i).FirstName+" "+mmn.user.data.Parents.get(i).LastName+" "+mmn.user.data.Parents.get(i).Pid);
		}
		if(selParentcB==null)
		{ 
		selParentcB = new JComboBox(data);
		selParentcB.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		selParentcB.setBounds(189, 139, 322, 22);
			
		}
		return selParentcB;
	}
	
	public JButton getUnBlockBtn()
	{   
		if(btnUnBlock==null)
		{
			btnUnBlock = new JButton("UnBlock");
			btnUnBlock.addActionListener(new ActionListener() {
		 	public void actionPerformed(ActionEvent e) {
		 		
		 		//TODO Update DB 
		 	}
		 });
			btnUnBlock.setBounds(439, 264, 91, 23);
			
		}
		return btnUnBlock;
	}
	
	private void initialize(ManagmentMainMenu mmn)
	{
		setLayout(null);
		
		 lblBlockScreen = new JLabel("UnBlock screen");
		lblBlockScreen.setBounds(307, 11, 59, 14);
		add(lblBlockScreen);
		
		 lblSelectParent = new JLabel("Select Parent:");
		lblSelectParent.setBounds(83, 143, 68, 14);
		add(lblSelectParent);
		add( getSelParentCb(mmn));
		add(getUnBlockBtn());
		
	}
	
	
	
	public ManagmentSelParentUnblock(ManagmentMainMenu mmn) {
		super();
		initialize(mmn);
		
	}
}
